#!/bin/bash

set -e
set -x

bypy download redis-7.0.15.tar.gz
tar xf redis-7.0.15.tar.gz
cd redis-7.0.15
make
make PREFIX=/usr/local/redis install
cd ..

mkdir /usr/local/redis/{conf,log,data}
# data目录主要存放持久化文件
\cp redis.conf /usr/local/redis/conf/
#把redis配置文件复制到/usr/local/redis/conf/目录下
useradd -M -s /sbin/nologin redis
#创建redis用户
chown -R redis.redis /usr/local/redis/
#修改属主属组为redis

cp redis.service /usr/lib/systemd/system/
systemctl daemon-reload
systemctl enable --now redis

set +x
set +e